import request from '@/utils/request'

export function uploadInventory(param) {
  return request({
    url: '/mall/api/manager/goods/inventory/upload',
    method: 'post',
    data: param,
    timeout: 60000 * 5
  })
}

export function downloadInventoryTemplate() {
  return request({
    url: '/mall/api/manager/goods/inventory/template',
    method: 'get',
    responseType: 'blob',
    timeout: 30000
  })
}

export function downloadInventory(param) {
  return request({
    url: '/mall/api/manager/goods/inventory/download',
    method: 'post',
    data: param,
    responseType: 'blob',
    timeout: 60000 * 5
  })
}

export function getProductInventory(query) {
  return request({
    url: '/mall/api/manager/goods/product-inventory',
    method: 'get',
    params: query
  })
}

export function getProductByPage(query) {
  return request({
    url: '/mall/api/manager/goods/product',
    method: 'get',
    params: query
  })
}

export function addProduct(data) {
  return request({
    url: '/mall/api/manager/goods/product',
    method: 'post',
    data
  })
}

export function getProductById(id) {
  return request({
    url: '/mall/api/manager/goods/product/' + id,
    method: 'get'
  })
}

export function putProductById(id, data) {
  return request({
    url: '/mall/api/manager/goods/product/' + id,
    method: 'put',
    data
  })
}

export function deleteProductById(id) {
  return request({
    url: '/mall/api/manager/goods/product/' + id,
    method: 'delete'
  })
}

export function downloadProduct(param) {
  return request({
    url: '/mall/api/manager/goods/product/download',
    method: 'get',
    params: param,
    responseType: 'blob',
    timeout: 60000 * 5
  })
}

export function uploadProduct(param) {
  return request({
    url: '/mall/api/manager/goods/product/upload',
    method: 'post',
    data: param,
    timeout: 60000 * 5
  })
}

export function downloadProductTemplate() {
  return request({
    url: '/mall/api/manager/goods/product/template',
    method: 'get',
    responseType: 'blob',
    timeout: 30000
  })
}

export function getSizeByPage(query) {
  return request({
    url: '/mall/api/manager/goods/size',
    method: 'get',
    params: query
  })
}

export function addSize(data) {
  return request({
    url: '/mall/api/manager/goods/size',
    method: 'post',
    data
  })
}

export function getSizeById(id) {
  return request({
    url: '/mall/api/manager/goods/size/' + id,
    method: 'get'
  })
}

export function putSizeById(id, data) {
  return request({
    url: '/mall/api/manager/goods/size/' + id,
    method: 'put',
    data
  })
}

export function deleteSizeById(id) {
  return request({
    url: '/mall/api/manager/goods/size/' + id,
    method: 'delete'
  })
}

export function downloadSize(param) {
  return request({
    url: '/mall/api/manager/goods/size/download',
    method: 'get',
    params: param,
    responseType: 'blob',
    timeout: 60000 * 5
  })
}

export function uploadSize(param) {
  return request({
    url: '/mall/api/manager/goods/size/upload',
    method: 'post',
    data: param,
    timeout: 60000 * 5
  })
}

export function downloadSizeTemplate() {
  return request({
    url: '/mall/api/manager/goods/size/template',
    method: 'get',
    responseType: 'blob',
    timeout: 30000
  })
}

export function getBarcodeByPage(query) {
  return request({
    url: '/mall/api/manager/goods/barcode',
    method: 'get',
    params: query
  })
}

export function addBarcode(data) {
  return request({
    url: '/mall/api/manager/goods/barcode',
    method: 'post',
    data
  })
}

export function getBarcodeById(id) {
  return request({
    url: '/mall/api/manager/goods/barcode/' + id,
    method: 'get'
  })
}

export function putBarcodeById(id, data) {
  return request({
    url: '/mall/api/manager/goods/barcode/' + id,
    method: 'put',
    data
  })
}

export function deleteBarcodeById(id) {
  return request({
    url: '/mall/api/manager/goods/barcode/' + id,
    method: 'delete'
  })
}

export function downloadBarcode(param) {
  return request({
    url: '/mall/api/manager/goods/barcode/download',
    method: 'get',
    params: param,
    responseType: 'blob',
    timeout: 60000 * 5
  })
}

export function uploadBarcode(param) {
  return request({
    url: '/mall/api/manager/goods/barcode/upload',
    method: 'post',
    data: param,
    timeout: 60000 * 5
  })
}

export function downloadBarcodeTemplate() {
  return request({
    url: '/mall/api/manager/goods/barcode/template',
    method: 'get',
    responseType: 'blob',
    timeout: 30000
  })
}
